package Text1;

import java.util.Collection;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Text1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            String a = in.nextLine();
            String b = in.nextLine();
            func(a,b);
        }
    }

    private static void func(String a, String b) {
        HashSet<Character> set = new HashSet<>();
        a=a.toUpperCase ();
        b=b.toUpperCase();
        for (int i = 0; i < b.length(); i++) {
            set.add(b.charAt(i));
        }
        for (int i = 0; i < a.length(); i++) {
            char ch=a.charAt(i);
            if(!set.contains(ch)){
                System.out.print(ch);
                set.add(ch);
            }
        }
    }

}
